import React, {Component} from "react";
import PropType from 'prop-types';
import './alertTip.scss';

export default class AlertTip extends Component {
  static propTypes = {
    alertText: PropType.string.isRequired, // 弹窗内容
    closeTip: PropType.func.isRequired, // 关闭函数
    logout: PropType.func // 推出登录
  }

  render() {
    return (
      <section className="alert-container">
        <div className="alert-mask"/>
        <div className="tip-text-wrap">
          <div className='tip-icon'>
            <span/>
            <span/>
          </div>

          <div className='tip-text'>{this.props.alertText}</div>

          {
            this.props.logout('wait')
              ?
              <div className='logout'>
                <div onClick={this.props.closeTip}>再等等</div>
                <div onClick={this.props.logout}>狠心离开</div>
              </div>
              :
              <div className='confirm' onClick={this.props.closeTip}>确认</div>
          }
        </div>
      </section>
    )
  }

}